package com.sun.module_base.ext

import com.hjq.toast.ToastParams
import com.hjq.toast.Toaster
import com.hjq.toast.style.CustomToastStyle
import com.sun.module_base.R

/**
 *@author:sunc
 *@time :2025/7/21 15:53
 *@desc: toast
 */

/**
 * 显示时间较短的吐司
 *
 * @param text String，显示的内容
 */
fun showToast(text: String?) {
    val params = ToastParams()
    params.text = text
    params.style = CustomToastStyle(R.layout.custom_toast)
    Toaster.show(params)

}

fun toastError(content: String) {
    val params = ToastParams()
    params.text = content
    params.style = CustomToastStyle(R.layout.custom_toast_error)
    Toaster.show(params)
}
fun toastSuccess(content: String) {

    val params = ToastParams()
    params.text = content
    params.style = CustomToastStyle(R.layout.custom_toast_success)
    Toaster.show(params)
}


/**
 * 显示时间较长的吐司
 *
 * @param text String，显示的内容
 */
fun showLongToast( text: String?) {
    val params = ToastParams()
    params.text = text
    params.style = CustomToastStyle(R.layout.custom_toast)
    Toaster.showLong(params)

}